package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.BrandCategoryAndNewDTO;
import cn.tedu.csmall.product.service.IBrandCategoryService;
import cn.tedu.csmall.product.service.IBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "03.品牌与类别管理模块")
@RestController
@Slf4j
@RequestMapping("brandCategory")
public class BrandCategoryController {
    @Autowired
    IBrandCategoryService service;
    public BrandCategoryController() {
        log.info("创建配置类:BrandCategoryController ");
    }
    @ApiOperation("添加平牌和类别数据")
    @PostMapping("/and")
    public String and(BrandCategoryAndNewDTO brandCategoryAndNewDTO){
        log.debug("请求参数：{}",brandCategoryAndNewDTO);
        service.andNew(brandCategoryAndNewDTO);
        return "添加完成！";
    }
    @ApiOperation("根据id删除平牌和类别数据")
    @PostMapping("/{id:[0-9]+]}/delete")
    public String delete(@PathVariable Long id){
        log.debug("请求参数：{}",id);
        service.delete(id);
        return "删除完成！";
    }
}
